﻿using System;
using WebFormsMvp.Contrib.Views;

namespace WebFormsMvp.Contrib.Presenters
{
    public abstract class FeedbackPresenter : Presenter<IFeedbackView>
    {
        public FeedbackPresenter(IFeedbackView view) : base(view)
        {
            view.Load += new EventHandler(View_Load);
            view.Submit += new EventHandler<FeedbackEventArgs>(View_Submit);
        }

        public virtual void View_Load(object sender, EventArgs e) { }

        public abstract void View_Submit(object sender, FeedbackEventArgs e); 
        
        public override void ReleaseView()
        {
            this.View.Load -= new EventHandler(View_Load);
            this.View.Submit -= new EventHandler<FeedbackEventArgs>(View_Submit);
        }
    }
}
